int thirdMax(int* nums, int numsSize){
    int first,second,third;
    int i;
    int min=nums[0];
    for(i=1;i<numsSize;i++){
        if(nums[i]<min){
            min=nums[i];
        }
    }
    first=second=third=min;
    for(i=0;i<numsSize;i++){
        if(nums[i]>first){
            third=second;
            second=first;
            first=nums[i];
        }
        else if(nums[i]>second&&nums[i]!=first){
            third=second;
            second=nums[i];
        }
        else if(nums[i]>third&&nums[i]!=first&&nums[i]!=second){
            third=nums[i];
        }
    }
    if(third==second||second==first){
        return first;
    }
    return third;
}